<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/22 0022
 * Time: 上午 12:03
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class Details extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->helper('url');
    }

    public function index()
    {
    	// 详情页
        $data['title']='房地产详情';
        //渲染页面
        // 就差一个house_id 只要接受一个house_id 就可以了
        $house_id=$this ->uri ->segment(4);
         //print_r($house_id);die;

        // 查询所有的的新闻信息
        $data['details']=$this ->db 
        ->select('*')
        ->from('house')
        ->join('type',"house.house_type=type.type_id")
        ->join('floor',"house.floor_sn=floor.floor_id")
        ->where(['house.house_id'=>$house_id])
        ->get()
        ->row_array();
       // print_r($data['details']);die;
        $data['house']=$this ->db ->limit(3)->get('house')->result_array();

        $this->load->view('home/header',$data);   //公共的头部
        $this->load->view('home/details',$data);  //主体内容
        $this->load->view('home/footer',$data);  //尾部

    }

    public function asd()
    {
    	echo "fasdfasdf";
    }





}